<template>
  <a-modal
    title="添加重点键"
    :width="800"
    :visible="visible"
    @ok="ok()"
    @cancel="cancel()"
  >
    <a-form-model :model="item" :label-col="{span :4 }" :wrapper-col="{ span: 20 }">
      <a-form-model-item label="区域" required>
        <a-input v-model="item.problemTerritory"  :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
      <a-form-model-item label="信访编号" required>
        <a-input v-model="item.xfjbh"  :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
      <a-form-model-item label="反应内容" required>
        <a-input v-model="item.content" type="textarea" :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
      <a-form-model-item label="承办单位" required>
        <a-input v-model="item.organizer"  :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
      <a-form-model-item label="类型" required>
        <a-input v-model="item.contentType"  :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
      <a-form-model-item label="列为重点件理由" required>
        <a-input v-model="item.reason" type="textarea" :auto-size="{ minRows: 5 ,maxRows: 5}"/>
      </a-form-model-item>
    </a-form-model>
  </a-modal>
</template>


<script>
import EpaWeekly from '@/myService/EpaWeekly'
export default {
  name: "AddZdj",
  data () {
    return {
      visible:false,
      item:{
        problemTerritory:'',
        content:'',
        organizer:'',
        contentType:'',
        reason:'',
        reportId:'',
        xfjbh:'',
        dwmc:''
      },
      selectedRowKeys:[]
    }
  },
  methods:{
    open(selectedRows,selectedRowKeys,reportId){
      this.selectedRowKeys=selectedRowKeys;
      this.item.reason="";
      this.item.contentType="";
      this.item.problemTerritory=selectedRows[0].dwmc.slice(0,3);
      this.item.content=selectedRows[0].xfrsq
      this.item.organizer=selectedRows[0].dwmc
      this.item.reportId=reportId
      this.item.xfjbh=''
      for(var i=0;i<selectedRowKeys.length;i++){
        this.item.xfjbh+=selectedRowKeys[i]+"、"
      }
      this.visible = true;
    },
    ok(){
      EpaWeekly.addZdj(this.item).then((res)=>{
        if(res.result>0){
          this.$message.success("添加成功")
          this.visible = false
          this.$emit('refreshXfj',this.selectedRowKeys);
        }
      })
    },
    cancel(){
      this.visible = false
    },
  }
}
</script>

<style scoped>

</style>